package com.space.user.domain.info.valueobject;

import cn.hutool.core.util.PhoneUtil;
import cn.hutool.core.util.StrUtil;
import com.space.components.exception.ExceptionFactory;
import lombok.Getter;
/**
 * @author <a href="mailto:414563035@qq.com">Bedroom</a>
 * @date 2021/4/14 6:22 下午
 */
@Getter
public class PhoneNumber {
    private final String phoneNumber;
    public PhoneNumber(String phoneNumber) {
        if (StrUtil.isNotEmpty(phoneNumber) && !PhoneUtil.isMobile(phoneNumber)) {
            throw ExceptionFactory.bizException("手机号码不正确");
        }
        this.phoneNumber = phoneNumber;
    }
}
